<template>
	<view class="main">
		<navbar transparent titleColor="#fff" :isBack="true"></navbar>
		<!-- <view class="blackBtn">
			<van-icon name="arrow-left" color="white" size="40rpx" />
		</view> -->
		<view class="posters">
			<img :src="baseImage + detail.picdir" alt="" class="postersImg" v-if="detail.picdir" />
			<img src="https://picui.cn/thumbnails/751471eb7d73c5a72420f88ec484c760.png'" alt="" class="postersImg" v-else/>
		</view>

		<view class="content">
			<view class="textBox">
				<view class="title">
					{{detail.title}}
				</view>
				<view class="p">
					<van-icon name="phone" color="#647EFF" size="25rpx" />
					<text class="t">联系方式：{{detail.tel}}</text>
				</view>
				<view class="p">
					<van-icon name="location" color="#647EFF" size="25rpx" />
					<text class="t">地址：{{detail.addr}}</text>
				</view>
			</view>

			<view class="textBox">
				<view class="title">
					详情
				</view>
				<view class="p">
					<rich-text :nodes="getImgWidth(detail.cnt)"></rich-text>
				</view>
			</view>
		</view>
		<!-- <Tabber currentPagePath="user"></Tabber> -->
	</view>
</template>

<script>
	import Navbar from '@/components/Navbar.vue'
	import Tabber from '@/pages/common/Tabber.vue'
	import {
		mapGetters,
		mapState
	} from "vuex"
	import {getCataDetail} from "@/core/web-api/common.js"
	export default {
		data() {
			return {
				id:"",
				detail:{}
			}
		},
		components: {
			Tabber,
			Navbar
		},
		computed:{
			...mapGetters(['getStateHeight', 'getNavbar','getSafeBottom']),
			...mapState(['baseImage']),
			getImgWidth(){
				return function(cnt){
					if(!cnt || !cnt.includes('<img')) return cnt;
					cnt = cnt.replace(/<img/g,'<img style="max-width:100%"')
					console.log(cnt)
					return cnt;
				}
			}
		},
		methods: {
			getDetail(){
				getCataDetail({id:this.id}).then(res=>{
					if(res.code==20000){
						this.detail = res.data.detail;
					}
				})
			}
		},
		onLoad(options) {
			this.id = options.id;
			this.getDetail();
		}
		
	}
</script>

<style scoped lang="less">
	.main {
		width: 100%;
	}
	
	.item{
		&-box{
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-bottom: 30upx;
		}
		
		background-color: #fff;
		border-radius: 20upx;
		width: 30%;
		padding:30upx;
		box-sizing: border-box;
		text-align: center;
		&-num{
			font-size: 30upx;
			color: #000;
			font-weight: bold;
		}
		&-label{
			font-size: 26upx;
			color: #333;
			margin-top: 10upx;
		}
	}
	

	.content {
		width: 100%;
		padding: 0 30rpx;
		box-sizing: border-box;
	}

	.blackBtn {
		position: fixed;
		top: 61rpx;
		left: 54rpx;
	}

	.posters {
		width: 100%;
		margin-bottom: 27rpx;
	}

	.posters .postersImg {
		width: 100%;
		height: 588rpx;
		object-fit: cover;
	}

	.textBox {
		width: 100%;
		padding: 37rpx 70rpx 60rpx;
		box-sizing: border-box;
		background: #FFFFFF;
		box-shadow: 0rpx 3rpx 7rpx 0rpx rgba(220, 220, 220, 0.35);
		border-radius: 10rpx;
		margin-bottom: 31rpx;
	}

	.textBox .title {
		font-family: Microsoft YaHei;
		font-weight: bold;
		font-size: 30rpx;
		color: #010101;
		margin-bottom: 30rpx;
		padding-left: 5rpx;
	}

	.textBox .p {
		width: 100%;
		margin-bottom: 16rpx;
	}

	.textBox .t {
		margin-left: 7rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		font-size: 26rpx;
		color: #989898;
		
	}
</style>